package com.edu.app.service.impl.core;

import com.edu.app.bean.core.SysPermission;
import com.edu.app.bean.core.SysUser;

import com.edu.app.mapper.core.SysPermissionMapper;
import com.edu.app.service.impl.SysBaseServiceImpl;
import com.edu.app.service.sys.core.SysPermissionService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;


@Service
public class SysPermissionServiceImpl extends SysBaseServiceImpl<SysPermission,SysPermissionMapper> implements SysPermissionService {

    @Autowired
    private SysPermissionMapper sysPermissionMapper;


    @Override
    public Integer update(SysPermission sysPermission){
        SysUser currentUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        sysPermission.setUpdate_time(new Date());
        sysPermission.setUpdate_by(currentUser.getUsername());

        return sysPermissionMapper.updateById(sysPermission);
    }


}
